package rmmk.opencv;

import javax.swing.JOptionPane;

public class OpenCV {
	static public void init() {
		String arch = System.getenv("PROCESSOR_ARCHITECTURE");
		String wow64Arch = System.getenv("PROCESSOR_ARCHITEW6432");

		boolean is64bit = (arch != null && arch.endsWith("64"))
				|| (wow64Arch != null && wow64Arch.endsWith("64"));

		try {
			if (is64bit) {
				System.loadLibrary("opencv_java245x64");
			} else {
				System.loadLibrary("opencv_java245x86");
			}
		} catch (UnsatisfiedLinkError e) {
			try {
				System.loadLibrary("opencv_java300"); // Unix
			} catch (UnsatisfiedLinkError ex) {
				JOptionPane.showMessageDialog(null, "Couldnt load OpenCV!");
			}
		}
	}
}